/**
 * Copyright (c) 2006-2007 Jinyi.lu
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of GNU LGPL license by gun.org
 * which accompanies this distribution, and is available at
 * http://gnu.feld-it.at/copyleft/lesser.html
 * 
 * Project Homepage : http://code.google.com/p/demou
 * Source Code: svn checkout http://demou.googlecode.com/svn/trunk/ demou
 * Mailing list : jinyi.lu@gmail.com
 *                stonelu@126.com
 *
 *  
 * Contributors:
 *     JinYi.Lu - initial API and implementation
 */
package cn.tworen.demou.remoting.cmd;

/**
 * Created on  2007-2-22
 *
 * Title       : Operation.java
 * Description : 
 * 
 * @author     : LuJinYi
 * @version    : 1.0
 * @Date       : 2007-2-22
 * History     : 
 * 
 */
public enum Operation {
	SUBSCRIBE(0), 
	UNSUBSCRIBE(1), 
	POLL(2), 
	CLIENT_SYNC(4), 
	CLIENT_PING(5), 
	CLUSTER_REQUEST(7), 
	LOGIN(8), 
	LOGOUT(9), 
	SESSION_INVALIDATE(10),
	UNKNOWN(10000);
	public int value = 10000;
	private Operation(int type) {
		this.value = type;
	}
	public static Operation getOperation(int type) {
		switch(type) {
		case 0:
			return SUBSCRIBE;
		case 1:
			return UNSUBSCRIBE;
		case 2:
			return POLL;
		case 4:
			return CLIENT_SYNC;
		case 5:
			return CLIENT_PING;
		case 7:
			return CLUSTER_REQUEST;
		case 8:
			return LOGIN;
		case 9:
			return LOGOUT;
		case 10:
			return SESSION_INVALIDATE;
		default:
			return UNKNOWN;
		}
	}
}
